<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: chengongsuo
  Date: 2018/5/2
  Time: 2:56 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>Title</title>
</head>
<body>

<c:forEach var="i" begin="1" end="10" step="1" varStatus="status">

</c:forEach>

<br/>

<%

    List<String> list = new ArrayList<String>();
    list.add("hello1");
    list.add("hello2");
    list.add("hello3");
    list.add("hello4");

    request.setAttribute("list", list);

%>

<c:forEach items="${list}" var="item" varStatus="status">
    count : ${status.count} <br/>
    index : ${status.index} <br/>
    first : ${status.first} <br/>
    last : ${status.last} <br/>
    current : ${status.current} <br/>
    ${item}<br/>
</c:forEach>

<br/>


<%

    Map<String, String> map = new HashMap<>();
    map.put("name", "chen");
    map.put("age", "12");
    map.put("gender", "male");

    session.setAttribute("map", map);
%>

<c:forEach items="${map}" var="item">
    ${item.key} - ${item.value}
</c:forEach>
</body>
</html>
